use super::*;

#[derive(Parser,Clone,Debug)]
pub struct WriteBookArgs {
    #[clap(short, long)]
    out: PathBuf,
    #[clap(short, long)]
    training: PathBuf,
}

impl WriteBookArgs {
    pub async fn run(self) -> eyre::Result<()> {
        let WriteBookArgs { out, training } = self;
        let training = fs::read_to_string(training)?;
        let training = serde_json::from_str(&training)?;
        write_training_to_mdbook(training, out).await
    }
}
